﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddNew.ascx.cs" Inherits="WebClient.admin.Modules.bill.AddNew" %>
<script type="text/javascript">
    var txtMy = "ctl00_contentCtrl_ctl00_txt";
    var Err = "Err";
    var ArrField = new Array("id", "customersId", "address", "create_on", "cardId", "total", "discount", "payment", "arrears", "credit", "status", "orderId", "isActive");
    function ClearAll() {
        var l = ArrField.length;
        for (var i = 0; i < l; i++) {
            var myVal = document.getElementById(txtMy + ArrField[i]);
            myVal.value = "";

        }

        HideAll();
        var myCtrl = document.getElementById(txtMy + ArrField[0]);
        myCtrl.focus();
        return false;
    }
    function HideAll() {
        var l = ArrField.length;
        for (var i = 0; i < l; i++) {
            var myVal = document.getElementById(Err + ArrField[i]);
            myVal.style.display = 'none';
        }
        return false;
    }
    function OnSubmitClick() {
        HideAll();
        var errExisting = false;
        var l = ArrField.length;
        var Errfocus = false;
        for (var i = 0; i < l; i++) {
            var myVal = document.getElementById(txtMy + ArrField[i]);
            if (myVal.value == "") {
                var obj = document.getElementById(Err + ArrField[i]);
                obj.style.display = 'block';
                errExisting = true;
            }
            if (errExisting && !Errfocus) {
                myVal.focus();
                Errfocus = true;
            }
        }

        return !errExisting;
    }   
</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
<table cellpadding="0" cellspacing="0" border="0">
    <tr height="25">
        <td>
            <span style="font-family: Helvetica; font-size: 13px; color: Green; font-weight: bold">
                Hóa đơn mua hàng</span></td>
    </tr>
    
    <tr>
        <td>
            <div runat="server" id="MyUpdate">
                <table id='tbSearch' width="735" cellpadding="2" cellspacing="0" rules="rows"  border="1"
                    style="border-collapse: collapse">
					 
					 <tr>
						<td align="left" class="left">customersId :</td>
						<td class="center"><asp:DropDownList ID="cbbcustomersId" runat="server" 
                                Width="300px">
                            </asp:DropDownList>
                           <span>(*) </span></td >
						<td class="right" ><div id="ErrcustomersId" class="Err" style="display:none;">Lỗi</div></td>
					</tr>
					 <tr>
						<td align="left" class="left">address :</td>
						<td class="center"><asp:TextBox width="300px" id="txtaddress" runat="server" 
						 textmode="SingleLine" CssClass="lsbOpenDay" emptymessage="" skin="Outlook" EnableViewState="true"></asp:TextBox><span>(*)</span></td >
						<td class="right" ><div id="Erraddress" class="Err" style="display:none;">Lỗi</div></td>
					</tr>
				
					
					 <tr>
						<td align="left" class="left">total :</td>
						<td class="center"><asp:TextBox width="300px" id="txttotal" runat="server" 
						 textmode="SingleLine" CssClass="lsbOpenDay" emptymessage="" skin="Outlook" EnableViewState="true" 
                                ReadOnly="True">0</asp:TextBox><span>(*)</span></td >
						<td class="right" ><div id="Errtotal" class="Err" style="display:none;">Lỗi</div></td>
					</tr>

					
					
                     <tr>
						<td align="left" class="left">payment :</td>
						<td class="center"><asp:TextBox width="300px" id="txtpayment" runat="server" 
						 textmode="SingleLine" CssClass="lsbOpenDay" emptymessage="" skin="Outlook" EnableViewState="true">0</asp:TextBox><span>(*)</span></td >
						<td class="right" ><div id="Errpayment" class="Err" style="display:none;">Lỗi</div></td>
					</tr>
					
			
					 <tr>
						<td align="left" class="left">orderId :</td>
						<td class="center"><asp:TextBox width="300px" id="txtorderId" runat="server" 
						 textmode="SingleLine" CssClass="lsbOpenDay" emptymessage="" skin="Outlook" EnableViewState="true">0</asp:TextBox><span>(*)</span></td >
						<td class="right" ><div id="ErrorderId" class="Err" style="display:none;">Lỗi</div></td>
					</tr>
					 
					<tr>
						<td align="center" colspan="3">
							<asp:Button runat="server" ID="btnAddNew" Text="Thêm mới" Font-Names="Helvetica"
							BorderStyle="Solid" BorderWidth="1" onclick="btnAddNew_Click"/>
							<asp:Button runat="server" ID="btnCancel" Text="Nhập lại" Font-Names="Helvetica"
							BorderStyle="Solid" BorderWidth="1"/>
						</td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
</table>


<table cellpadding="0" cellspacing="0" border="0">
    <tr height="25">
        <td>
            <span style="font-family: Helvetica; font-size: 13px; color: Green; font-weight: bold">
                Nhập chi tiết mặt hàng</span></td>
    </tr>
    
    <tr>
        <td>
            <div runat="server" id="Div1">
                <table id='Table1' width="735" cellpadding="2" cellspacing="0" rules="rows"  border="1"
                    style="border-collapse: collapse">
				
					
					 <tr>
						<td align="left" class="left">productId :</td>
						<td class="center">
                            <asp:DropDownList ID="cbbproductId" runat="server" Width="300px">
                            </asp:DropDownList>
                            <span>(*)</span></td >
						<td class="right" ><div id="ErrproductId" class="Err" style="display:none;">Lỗi</div></td>
					</tr>
					 <tr>
						<td align="left" class="left">numberOf :</td>
						<td class="center"><asp:TextBox width="300px" id="txtnumberOf" runat="server" 
						 textmode="SingleLine" CssClass="lsbOpenDay" emptymessage="" skin="Outlook" EnableViewState="true">0</asp:TextBox><span>(*)</span></td >
						<td class="right" ><div id="ErrnumberOf" class="Err" style="display:none;">Lỗi</div></td>
					</tr>
					 <tr>
						<td align="left" class="left">unitPriceUSD :</td>
						<td class="center"><asp:TextBox width="300px" id="txtunitPriceUSD" runat="server" 
						 textmode="SingleLine" CssClass="lsbOpenDay" emptymessage="" skin="Outlook" EnableViewState="true">0</asp:TextBox><span>(*)</span></td >
						<td class="right" ><div id="ErrunitPriceUSD" class="Err" style="display:none;">Lỗi</div></td>
					</tr>
					
					 <tr>
						<td align="left" class="left">unitPriceVND :</td>
						<td class="center"><asp:TextBox width="300px" id="txtunitPriceVND" runat="server" 
						 textmode="SingleLine" CssClass="lsbOpenDay" emptymessage="" skin="Outlook" EnableViewState="true" 
                                ReadOnly="True">0</asp:TextBox><span>(*)</span></td >
						<td class="right" ><div id="ErrunitPriceVND" class="Err" style="display:none;">Lỗi</div></td>
					</tr>

					
					 <tr>
						<td align="left" class="left">cash :</td>
						<td class="center"><asp:TextBox width="300px" id="txtcash" runat="server" 
						 textmode="SingleLine" CssClass="lsbOpenDay" emptymessage="" skin="Outlook" EnableViewState="true" 
                                ReadOnly="True">0</asp:TextBox><span>(*)</span></td >
						<td class="right" ><div id="Errcash" class="Err" style="display:none;">Lỗi</div></td>
					</tr>
					
					<tr>
						<td align="center" colspan="3">
							<asp:Button runat="server" ID="btnAdd" Text="Add" Font-Names="Helvetica"
							BorderStyle="Solid" BorderWidth="1" onclick="btnAdd_Click" />
							<asp:Button runat="server" ID="Button2" Text="Nhập lại" Font-Names="Helvetica"
							BorderStyle="Solid" BorderWidth="1"/>
						</td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
</table>

<input type="hidden" value="false" id="Duyet" runat="server"/>
<input type="hidden" value="false" id="hidDelete" runat="server" />
<table width="735" cellpadding="0" cellspacing="0">
  
    <tr>
        <td  align="center">
            <div style="padding: 5px 0px 5px 0px" runat="server" id="Div2">
                
                    
                      <asp:GridView ID="grdDs" runat="server" Width="100%" BorderColor="Transparent" PageSize="25" 
                        AllowPaging="True" AutoGenerateColumns="False" CellPadding="0"  
                            DataKeyNames="id" BorderWidth="1px"
                            >                        
                        <Columns>                        
                          <asp:TemplateField HeaderText="STT" HeaderStyle-Width="20" HeaderStyle-HorizontalAlign="center"
                            HeaderStyle-BorderColor="Black" HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1"
                            ItemStyle-HorizontalAlign="Center" ItemStyle-BorderColor="Black" ItemStyle-BorderStyle="Solid"
                            ItemStyle-BorderWidth="1" FooterStyle-BorderColor="Black" FooterStyle-BorderStyle="Solid"
                            FooterStyle-BorderWidth="1" >
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblSTT" Text='<%# Container.DataItemIndex + 1%>' />
                            </ItemTemplate>
                              <FooterStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                              <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" 
                                  HorizontalAlign="Center" Width="20px" />
                              <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" 
                                  HorizontalAlign="Center" />
                        </asp:TemplateField>

                           <asp:TemplateField ItemStyle-CssClass="WordWrapItem" HeaderText="id" ItemStyle-VerticalAlign="Middle"  HeaderStyle-BorderColor="Black" HeaderStyle-BorderStyle="Solid"
                            HeaderStyle-BorderWidth="1" ItemStyle-HorizontalAlign="Left" ItemStyle-BorderColor="Black"
                            ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1" FooterStyle-BorderColor="Black"
                            FooterStyle-BorderStyle="Solid" FooterStyle-BorderWidth="1" Visible="false">
                            <ItemTemplate>                               
                               <span style="font-weight:bold;"><%#Convert.ToString(DataBinder.Eval(Container.DataItem, "id"))%>                                                                                                       
                               </span>
                            </ItemTemplate>
                               <FooterStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" 
                                   CssClass="WordWrapItem" HorizontalAlign="Left" VerticalAlign="Middle" />
                        </asp:TemplateField>  

                          

                           <asp:TemplateField ItemStyle-CssClass="WordWrapItem" HeaderText="productName" ItemStyle-VerticalAlign="Middle"  HeaderStyle-BorderColor="Black" HeaderStyle-BorderStyle="Solid"
                            HeaderStyle-BorderWidth="1" ItemStyle-HorizontalAlign="Left" ItemStyle-BorderColor="Black"
                            ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1" FooterStyle-BorderColor="Black"
                            FooterStyle-BorderStyle="Solid" FooterStyle-BorderWidth="1">
                            <ItemTemplate>                               
                               <span style="font-weight:bold;"><%#Convert.ToString(DataBinder.Eval(Container.DataItem, "productName"))%>                                                                                                       
                               </span>
                            </ItemTemplate>
                               <FooterStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" 
                                   CssClass="WordWrapItem" HorizontalAlign="Left" VerticalAlign="Middle" />
                        </asp:TemplateField>  

                           <asp:TemplateField ItemStyle-CssClass="WordWrapItem" HeaderText="numberOf" ItemStyle-VerticalAlign="Middle"  HeaderStyle-BorderColor="Black" HeaderStyle-BorderStyle="Solid"
                            HeaderStyle-BorderWidth="1" ItemStyle-HorizontalAlign="Left" ItemStyle-BorderColor="Black"
                            ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1" FooterStyle-BorderColor="Black"
                            FooterStyle-BorderStyle="Solid" FooterStyle-BorderWidth="1">
                            <ItemTemplate>                               
                               <span style="font-weight:bold;"><%#Convert.ToString(DataBinder.Eval(Container.DataItem, "numberOf"))%>                                                                                                       
                               </span>
                            </ItemTemplate>
                               <FooterStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" 
                                   CssClass="WordWrapItem" HorizontalAlign="Left" VerticalAlign="Middle" />
                        </asp:TemplateField>  

                           <asp:TemplateField ItemStyle-CssClass="WordWrapItem" HeaderText="unitPriceUSD" ItemStyle-VerticalAlign="Middle"  HeaderStyle-BorderColor="Black" HeaderStyle-BorderStyle="Solid"
                            HeaderStyle-BorderWidth="1" ItemStyle-HorizontalAlign="Left" ItemStyle-BorderColor="Black"
                            ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1" FooterStyle-BorderColor="Black"
                            FooterStyle-BorderStyle="Solid" FooterStyle-BorderWidth="1">
                            <ItemTemplate>                               
                               <span style="font-weight:bold;"><%#Convert.ToString(DataBinder.Eval(Container.DataItem, "unitPriceUSD"))%>                                                                                                       
                               </span>
                            </ItemTemplate>
                               <FooterStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" 
                                   CssClass="WordWrapItem" HorizontalAlign="Left" VerticalAlign="Middle" />
                        </asp:TemplateField>  
                 

                           <asp:TemplateField ItemStyle-CssClass="WordWrapItem" HeaderText="cash" ItemStyle-VerticalAlign="Middle"  HeaderStyle-BorderColor="Black" HeaderStyle-BorderStyle="Solid"
                            HeaderStyle-BorderWidth="1" ItemStyle-HorizontalAlign="Left" ItemStyle-BorderColor="Black"
                            ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1" FooterStyle-BorderColor="Black"
                            FooterStyle-BorderStyle="Solid" FooterStyle-BorderWidth="1">
                            <ItemTemplate>                               
                               <span style="font-weight:bold;"><%#Convert.ToString(DataBinder.Eval(Container.DataItem, "cash"))%>                                                                                                       
                               </span>
                            </ItemTemplate>
                               <FooterStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" 
                                   CssClass="WordWrapItem" HorizontalAlign="Left" VerticalAlign="Middle" />
                        </asp:TemplateField>                         

                           <asp:TemplateField HeaderText="Xóa" ItemStyle-Width="20" HeaderStyle-BorderColor="Black"
                            HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1" ItemStyle-HorizontalAlign="Left"
                            ItemStyle-BorderColor="Black" ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1"
                            FooterStyle-BorderColor="Black" FooterStyle-BorderStyle="Solid" FooterStyle-BorderWidth="1">
                            <ItemTemplate>
                                <asp:CheckBox runat="server" ID="chkDelete" />
                            </ItemTemplate>
                               <FooterStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
                               <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" 
                                   HorizontalAlign="Left" Width="20px" />
                        </asp:TemplateField>

                        </Columns>

                        </asp:GridView>
                     
                 
                
            </div>
        </td>
    </tr>
    
</table>

   </ContentTemplate>
                </asp:UpdatePanel>